var get=require('../../../utils/getRequest');
var post=require('../../../utils/postRequest');
const api= require('../../../utils/api')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    agentName:null,
    agentPhone:null,
    agentIdentity:null,
    agentAddress:null,
    agentMerchantCode:null
  },
  submitBingMsg(){
    var agentName=this.data.agentName;
    var agentPhone=this.data.agentPhone;
    var agentIdentity=this.data.agentIdentity;
    var agentAddress=this.data.agentAddress;
    var agentMerchantCode=this.data.agentMerchantCode;
    console.log("agentName======="+agentName)
    if(agentName==null||agentName==""){
      wx.showToast({
        title: '姓名不能为空',
        icon: 'error',
        duration: 1000
      })
      return;
    }
    if(agentPhone==null||agentPhone==""){
      wx.showToast({
        title: '手机号不能为空',
        icon: 'error',
        duration: 1000
      })
      return;
    }
    if(agentIdentity==null||agentIdentity==""){
      wx.showToast({
        title: '身份证不能为空',
        icon: 'error',
        duration: 1000
      })
      return;
    }
    if(agentAddress==null||agentAddress==""){
      wx.showToast({
        title: '地址不能为空',
        icon: 'error',
        duration: 1000
      })
      return;
    }
    var data={
              agentName:agentName,
              agentPhone:agentPhone,
              agentIdentity:agentIdentity,
              agentAddress,agentAddress,
              agentMerchantCode:null,
              agentOpenId:api.openId
            }
    post.postRequest(null,api.setAgentBingMsg,data).then(res=>{
      wx.showModal({
        title: '提示信息',
        showCancel:false,
        content: res.msg,
      })
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})